package com.haust.su.ghyy.hospital.controller;

import com.haust.su.ghyy.common.result.Result;
import com.haust.su.ghyy.hospital.service.ScheduleService;
import com.haust.su.ghyy.model.hosp.Schedule;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author haustsusu
 * @create 2023-04-29-20:07
 */
@Api(tags = "显示排班信息")
@RestController
@RequestMapping("/admin/hosp/Schedule")
//@CrossOrigin
public class ScheduleDetailController {

    @Autowired
    private ScheduleService scheduleService;


    //根据医院编号与科室编号,查询排班规则数据
    @ApiOperation(value = "查询排班规则数据")
    @GetMapping("getScheduleRule/{page}/{limit}/{hoscode}/{depcode}")
    public Result getScheduleRule(@PathVariable long page,
                                  @PathVariable long limit,
                                  @PathVariable String hoscode,
                                  @PathVariable String depcode){
       Map<String,Object> map= scheduleService.getRuleSchedule(page,limit,hoscode,depcode);
       return Result.ok(map);
    }


    //根据医院编号,科室信息和工作日期,查询排班的详细信息
    @ApiOperation(value = "查询排班详细信息")
    @GetMapping("getScheduleDetail/{hoscode}/{depcode}/{workDate}")
    public Result getScheduleDetail(@PathVariable String hoscode,
                                    @PathVariable String depcode,
                                    @PathVariable String workDate){
        List<Schedule> list=scheduleService.getDetailSchedule(hoscode,depcode,workDate);
        return Result.ok(list);
    }

}
